-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gmlwls96] Week7 #913
[gmlwls96] Week7 #913
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요 :)
이번 한 주도 수고 많으셨습니다
코멘트 남겨놓았으니 병합 전에 확인 바랍니다
감사합니다!!
s.forEach { // s를 조회하면서 글자를 subStr에 담는다. | ||
if (subStr.contains(it)) { // 단, 겹치는 글자가 있을경우 subStr의 len을 기록하고, 초기화 한다. | ||
max = max(max, subStr.length) | ||
subStr.delete(0, subStr.length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 로직이 오류를 유발합니다
답안 통과를 하지 못하고 있는데, 인지하고 계신가요?
@@ -0,0 +1,43 @@ | |||
class Solution { | |||
// 시간 : O(N), 공간 O(N) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
문제 설명에서 주어진 변수가 m, n (2차원 배열의 행, 열)이므로 복잡도 분석의 결과를 m, n을 이용해서 표현해주시거나 별도의 추가적인 설명을 곁들여주세요
var answerRoot: ListNode? = null | ||
|
||
while (currentHead != null) { | ||
answerRoot = ListNode(currentHead.`val`).apply { next = answerRoot } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answerRoot 뒤에 새로운 ListNode 인스턴스를 생성해서 추가하고 있으니까 공간 복잡도가 O(1)이 아닐 것 같아요
// dp 알고리즘. pathMap[y][x]로 올수 있는 경로의 수는 | ||
// 위쪽(pathMap[y - 1][x]) + 왼쪽( pathMap[y][x - 1]) 경로의 수의 합이다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pathMap[y][x] = pathMap[y - 1][x]) + 왼쪽( pathMap[y][x - 1]
이 점화식을 잘 보면 공간복잡도를 1차원으로 줄일 수 있다는 걸 알 수 있습니다
한 번 최적화해보시는 걸 추천드립니다~!
@gmlwls96 longest-substring 문제는 틀린 답안을 수정하지도 않으셨는데 병합 진행하셨네요? |
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.